package com.zhengqiangblog.blog.service;

import java.util.List;

import org.apache.log4j.Logger;

import com.zhengqiangblog.blog.cache.TagCache;
import com.zhengqiangblog.blog.model.Tag;
import com.zhengqiangblog.core.ApplicationContext;

public class TagService {

	private static final Logger logger = Logger.getLogger(TagService.class);

	private TagCache tagCache = ApplicationContext.get(TagCache.class);

	public TagService() {
		logger.info("TagService initializing...");
	}

	public int saveTag(Tag tag) throws Exception {
		return tagCache.saveTag(tag);
	}

	public int deleteTag(int tagId) throws Exception {
		return tagCache.deleteTag(tagId);
	}

	public List<Tag> getTagList() throws Exception {
		return tagCache.getTagList();
	}

	public Tag getTag(int tagId) throws Exception {
		return tagCache.getTag(tagId);
	}

	public Tag getTagByName(String tagName) throws Exception {
		return tagCache.getTagByName(tagName);
	}

	public int updateTag(Tag tag) throws Exception {
		return tagCache.updateTag(tag);
	}

}
